package com.wgz.ai.langchain4jai.memory;

import dev.langchain4j.chain.ConversationalRetrievalChain;
import dev.langchain4j.memory.ChatMemory;
import dev.langchain4j.memory.chat.ChatMemoryProvider;
import dev.langchain4j.memory.chat.TokenWindowChatMemory;
import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.model.openai.OpenAiChatModel;
import dev.langchain4j.model.openai.OpenAiTokenizer;
import jdk.dynalink.linker.ConversionComparator;

/**
 * @author WGZ
 * @date 2025/3/6 9:48
 */
public class ChatRetrievalExample {
    private final static String API_KEY = "sk-svcacct-J-zoI616zoIN8ghM6amdG_SbFNc3vADd5yRa-53EQkr-lPN0tjD8QgWJfAmSuT3BlbkFJxBhbhopzngM8ZUB8KwByRFPnJ5bDUT1eq2Kop0OlggeqfzdsNSF45DQFZ94mgA";

    public static void main(String[] args) {
        ChatMemory chatMemory = TokenWindowChatMemory.withMaxTokens(500,new OpenAiTokenizer("gpt-3.5-turbo"));

        ChatLanguageModel model = OpenAiChatModel.builder()
                .apiKey(API_KEY)
                .modelName("gpt-3.5-turbo")
                .logRequests(true)
                .logResponses(true)
                .build();
    }
}
